package com.cloudkinto.enumType.stock;

import com.baomidou.mybatisplus.core.enums.IEnum;
import lombok.Getter;

import java.util.*;

/**
 * 库存类型
 *
 * @author long
 */
@Getter
public enum StockOrderTypeEnum implements IEnum<String> {
    /**
     *
     */
    Convert("库存转换"),
    Move("移库单"),
    Adjust("库存调整单"),
    Return("退件单"),
    Defective("次品处理单"),
    StockCheck("盘点单"),
    Shelf("上架单"),
    Outbound("发货单"),
    Cancel("拦截单"),
    Inventory("盘点单"),
    Allocate("调拨计划"),
    PlatformOrder("平台订单");

    private final String desc;

    StockOrderTypeEnum(String desc) {
        this.desc = desc;
    }

    public static List<Map<String, Object>> getStockOrderTypeEnum() {
        List<Map<String, Object>> result = new ArrayList<>();
        for (StockOrderTypeEnum value : values()) {
            Map<String, Object> map = new HashMap<>();
            map.put("id", value.getValue());
            map.put("name", value.getDesc());
            result.add(map);
        }
        return result;
    }

    public static String getDesc(String value) {
        for (StockOrderTypeEnum stockOrderTypeEnum : values()) {
            if (Objects.equals(stockOrderTypeEnum.getValue(), value)) {
                return stockOrderTypeEnum.getDesc();
            }
        }
        return "";
    }

    @Override
    public String getValue() {
        return name();
    }

}
